<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>C:\WorkingCopy\ColorTest\sms.c.html</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=Big5">
<style type="text/css">
<!--
pre { font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
-->
</style>
</head>
<body>
<pre>
#define UNICODE
#include &lt;windows.h&gt;

int main(int argc, char **argv) {
  int speed = 0, speed1 = 0, speed2 = 0; // 1-20
  printf(&quot;Set Mouse Speed by Maverick\n&quot;);

  SystemParametersInfo(SPI_GETMOUSESPEED, 0, &amp;speed, 0);
  printf(&quot;Current speed: %2d\n&quot;, speed);

  if (argc == 1) return 0;
  if (argc &gt;= 2) sscanf(argv[1], &quot;%d&quot;, &amp;speed1);
  if (argc &gt;= 3) sscanf(argv[2], &quot;%d&quot;, &amp;speed2);

  if (argc == 2) // set speed to first value
    speed = speed1;
  else if (speed == speed1 || speed == speed2) // alternate
    speed = speed1 + speed2 - speed;
  else
    speed = speed1;  // start with first value

  SystemParametersInfo(SPI_SETMOUSESPEED, 0,  speed, 0);
  SystemParametersInfo(SPI_GETMOUSESPEED, 0, &amp;speed, 0);
  printf(&quot;New speed:     %2d\n&quot;, speed);
  return 0;
}
</pre>
</body>
</html>
